Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: switch python client to use openapi-generator #97

Merged

Conversation

tomplus
Copy link
Member

@tomplus tomplus commented Jan 27, 2019

The Python will be generated by openapi-generator. I also prepared this PR: kubernetes-client/python#738 to show what changes will be introduced to the generated client. Unfortunately this client used very old version of swagger-codegen.

Ref: #93

PTAL: @yliaog @roycaihw @mbohlool @brendandburns

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 27, 2019
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 27, 2019
CLIENT_LANGUAGE=python; \
CLEANUP_DIRS=(client/apis client/models docs test); \
CLEANUP_DIRS=(client/api client/apis client/models docs test); \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sub-package is renamed from apis to api. This changes has been already introduced in swagger-codegen.

find "${OUTPUT_DIR}/test" -type f -name \*.py -exec sed -i 's/\bclient/kubernetes.client/g' {} +
find "${OUTPUT_DIR}" -path "${OUTPUT_DIR}/base" -prune -o -type f -a -name \*.md -exec sed -i 's/\bclient/kubernetes.client/g' {} +
find "${OUTPUT_DIR}" -path "${OUTPUT_DIR}/base" -prune -o -type f -a -name \*.md -exec sed -i 's/kubernetes.client-python/client-python/g' {} +

# fix imports
find "${OUTPUT_DIR}/client/" -type f -name \*.py -exec sed -i 's/import client\./import kubernetes.client./g' {} +
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolute vs relative imports. It's not related to the openapi-generator too, the latest version of swagger-codegen uses absolute imports and here it's fixed by adding prefix kubernetes..

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 29, 2019
@tomplus
Copy link
Member Author

tomplus commented Apr 29, 2019

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 29, 2019
@tomplus tomplus changed the title [WIP] feat: switch python client to use openapi-generator feat: switch python client to use openapi-generator Apr 30, 2019
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 30, 2019
@tomplus
Copy link
Member Author

tomplus commented Apr 30, 2019

@yliaog @roycaihw please take a look, you can see generated code here: kubernetes-client/python#738

@brendandburns
Copy link
Contributor

@tomplus I'm happy to merge this if/when it is ready to go, but I defer to other reviewers...

@roycaihw
Copy link
Member

roycaihw commented Jul 2, 2019

/assign

@roycaihw
Copy link
Member

roycaihw commented Jul 3, 2019

Thanks for putting this together! I looked at kubernetes-client/python#738 and it's pretty neat. I had some minor questions that aren't blocking, so

/lgtm

I'd like to try this for the next 1.15 alpha release :)

@roycaihw
Copy link
Member

/assign @brendandburns

I tried picking this locally and the generated results look good. Could you approve this pull so we can generate using the upstream gen repo?

@yliaog
Copy link
Contributor

yliaog commented Sep 10, 2019

@brendandburns, could you add @roycaihw and @yliaog to the admin group of this repo, i think it is https://github.com/orgs/kubernetes-client/teams/gen-admins

@brendandburns
Copy link
Contributor

brendandburns commented Sep 13, 2019

Sorry for the delay, please ping me on slack or email in the future.

Happy to aad you to the admins, you need to file a PR with https://github.com/kubernetes/org

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, tomplus

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 13, 2019
@k8s-ci-robot k8s-ci-robot merged commit 475ad6f into kubernetes-client:master Sep 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants